{include file="header/index" /}
<style>
    table th,table td{
        text-align: left !important;
    }
</style>
<div class="container whitebg">
    <div class="topnav clearfix">
        <div class="title fl">
            <h3>工单详情&nbsp;--</h3>
            <a href="#information" class="ac">基本信息</a>
            <a href="#">工单信息</a>
            <a href="#">工单轨迹</a>
        </div>
        <div class="backbtnwrap fr">
            <button type="button" class="btn backbtn" onclick="backurl(this)">返回</button>
        </div>
    </div>

    <div class="information" id="information">
        <p class="title">基本信息</p>
        <table class="table table-bordered order_details_table">
                {volist name="basicData" id="k"}
            <tr>
                <th>姓名</th>
                <td>{$k.username}</td>
                <th>账户</th>
                <td>{$k.telphone}</td>
            </tr>
            <tr>
                <th>创建时间</th>
                <td>{:date('Y-m-d H:i:s',$k.add_time)}</td>
                <th>账号状态</th>
                <td class="redcolor" style="width: 60%">{$k.account_status ? '正常' : '冻结'}&nbsp;&nbsp;&nbsp;备注：{$k.remark}</td>
            </tr>
            <tr>
                <th>生日</th>
                <td>{:date('Y-m-d',$k.birthday)}</td>
                <th>联系电话</th>
                <td>{$k.telphone}</td>
            </tr>
            <tr>
                <th>联系地址</th>
                <td colspan="3">{$k.user_address}&nbsp;&nbsp;&nbsp;</td>
            </tr>
                {/volist}
        </table>
    </div>

    <div class="Orderinformation" id="Orderinformation">
        <p class="title">工单信息</p>
        <table class="table table-bordered">

                {volist name="workData" id="k"}
            <tr>
                <th>工单号</th>
                <td>{$k.order_number}</td>
                <th>合同编号</th>
                <td>{$k.contract_no}</td>
            </tr>
            <tr>
                <th>业务</th>
                <td>{$k.business_id}</td>
                <th>所属管理区域</th>
                <td>{$k.y_name}--{$k.company_name}</td>
            </tr>
            <tr>
                <th>处理状态</th>
                <td>{$k.work_order_status}</td>
                <th>工程人员</th>
                <td>{$k.engineers_name ? $k.engineers_name : '未指派'}</td>
            </tr>
            <tr>
                <th>工程人员电话</th>
                <td>{$k.engineers_phone ? $k.engineers_phone : '未指派'}</td>

                <th>设备号</th>
                <td>
                    {volist name="equipmentNumber" id="ke"  offset="0" length='1'}
                    设备号：{$ke.equipments_number}&nbsp;&nbsp;&nbsp;
                    {/volist}

                    {if condition="(count($equipmentNumber) > 1)"}
                    <button id="devicedetails" type="button" onmouseover="mouseshow(this)" onmouseout="mousehide(this)">●●●</button>
                    <div class="frame" style="width: 200px;">
                        <span class="triangle"></span>
                        {volist name="equipmentNumber" id="ke"  offset="1"}
                        设备号：{$ke.equipments_number}<br>
                        {/volist}
                    </div>
                    {/if}
                </td>

            </tr>
            <tr>
                <th>安装地址</th>
                <td>{$k.service_address}</td>
                <th>费用</th>
                <td>￥{$k.combo_money ? $k.combo_money : '0.00'}元</td>
            </tr>
            <tr>
                <th>移机新地址</th>
                <td class="newaddress">
                    <span>{$k.move_address}</span>
                </td>

                <th>更换配件</th>
                <td>
                    {volist name="partsData" id="ke"  offset="0" length='1'}
                    配件名称：{$ke.parts_name} ; 配件数量：{$ke.parts_number}
                    {/volist}

                    {if condition="(count($partsData) > 1)"}
                    <button id="devicedetails" type="button" onmouseover="mouseshow(this)" onmouseout="mousehide(this)">●●●</button>
                    <div class="frame" style="width: 200px;">
                        <span class="triangle"></span>
                        {volist name="partsData" id="ke"  offset="1"}
                        配件名称：{$ke.parts_name} ; 配件数量：{$ke.parts_number}<br>
                        {/volist}
                    </div>
                    {/if}
                </td>
            <tr>
                <th>联系人</th>
                <td>{$k.contacts}</td>
                <th>联系电话</th>
                <td>{$k.contact_number}</td>
            </tr>
            </tr>
                <th>备注</th>
                <td colspan="3" style="width: 90%">{$k.remarks}</td>
            </tr>
                {/volist}

        </table>
    </div>

    <div class="ordertrajectory" id="ordertrajectory">
        <p class="title">工单轨迹</p>
        <div class="ordertrajectory_list">
            {if condition="isset($userData)"}
            <!--工单轨迹-->
            {volist name="userData" id="k"}
            <p>{$k.remarks}<time>{:date('Y年m月d日 H:i:s',$k.operating_time)}</time></p>
            {/volist}
            {else /}
            <p>暂无记录</p>
            {/if}
        </div>
        <input type="hidden" name="" id="page" value="1" />
        <p class="title fr pointer" onclick="loadLog({$workData[0]['work_order_id']})">更多&nbsp;&nbsp;<i class="glyphicon glyphicon-chevron-down"></i></p>
    </div>
</div>
</body>

</html>
<script type="text/javascript">

    // 点击事件，获取更多工单轨迹
    function loadLog(workid){
        var page = $("#page").val();
        // 发送ajax请求，获取更多记录
        $.getJSON("{:url('/admin/workorder/getWorkLog')}",{workid:workid, page:page},function(data){
            if (data[0]['status'] == 1) {
                $("#page").val(data[0]['page']);
                var str = '';
                $.each(data,function(k,v){
                    str += '<p>'+ v.remarks +'<time>'+ v.operating_time +'</time></p>';
                });
                $(".ordertrajectory_list").append(str);
            }else{
                layer.msg('没有更多了', {icon: 0});
            }
        })
    }


    //鼠标移入移出
    function mousehide(obj) {
        $(obj).next().hide();
    }
    function mouseshow(obj) {
        $(obj).next().show();
    }

    //顶部导航
    $('.topnav a').click(function() {
        $(this).addClass('ac').siblings('a').removeClass();
    });

    //返回上一页
    function backurl() {
        history.back();
    };

</script>